package com.tiankun.eurekauserinfo.proxy;

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * Created with IntelliJ IDEA
 * User: bear
 * Date: 2020/11/16
 * Description
 * Version: V1.0
 */
@FeignClient(value = "EUREKA-TICKET")
public interface TicketHandler {

      /*
   这里需要几个要点：
   1.这里定义的路径作用是调用client中的接口
   2.method即使只定义了get，但feign还是会检查client是否允许post请求，如果没有post请求将报错
   3.@RequestParam(value = "name")是绑定controller中的形式参数名，如果没有value属性定义也会报错
    */

    @PostMapping(value = "/ticket/find",
            produces = MediaType.APPLICATION_JSON_VALUE)
    Map getTicket(@RequestParam("id") Integer id);

    @PostMapping(value = "/get/update",
            produces = MediaType.APPLICATION_JSON_VALUE)
    Map update(@RequestParam("id")Integer id,@RequestParam("phone")String phone, @RequestParam("usestate")Integer usestate);


}
